<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
			<meta http-equiv="pragma" content="no-cache">
				<meta http-equiv="cache-control" content="no-cache">
					<meta http-equiv="expires" content="0">
<link href="static/denglu/css/default.css" rel="stylesheet"
	type="text/css" />
<!--必要样式-->
<link href="static/denglu/css/styles.css" rel="stylesheet"
	type="text/css" />
<link href="static/denglu/css/demo.css" rel="stylesheet" type="text/css" />
<link href="static/denglu/css/loaders.css" rel="stylesheet"
	type="text/css" />
	<link href="static/denglu/layui/css/layui.css" rel="stylesheet"
		type="text/css" />
</head>
<title>登陆界面</title>
</head>
<body>
<div class='login'>
		<div class='login_title'>
			<span>用户登录</span>
		</div>
		<div class='login_fields'>
			<form id="loginForm" name="loginForm">
				<div class='login_fields__user'>
					<div class='icon'>
						<img alt="" src="static/denglu/img/user_icon_copy.png">
					</div>
					<input name="loginName" placeholder='账号' value="admin" maxlength="16"
						type='text' autocomplete="off" />
					<div class='validation'>
						<img alt="" src='static/denglu/img/tick.png'>
					</div>
				</div>
				<div class='login_fields__password'>
					<div class='icon'>
						<img alt="" src='static/denglu/img/lock_icon_copy.png'>
					</div>
					<input name="password" placeholder='密码' value="admin" maxlength="16"
						type='password' autocomplete="off">
						<div class='validation'>
							<img alt="" src='static/denglu/img/tick.png'>
						</div>
				</div>
				<div class='login_fields__password'>
					<div class='icon'>
						<img alt="" src='static/denglu/img/key.png'>
					</div>
				<input  placeholder='验证码' maxlength="4" type='text'
						name="ValidateNum" autocomplete="off">
						<%-- 	<div class='validation'
							style="opacity: 1; right: -5px; top: -3px;">
							<img src="static/CreateValidateSvt?time=<%=new Date().getTime()%>"
								class="J_codeimg" />
						</div> --%>
				</div>
			</form>
			<div class='login_fields__submit'>
				<input type='button' value='登录'>
			</div>
		</div>
		<div style="display: none" id="msg">${msg }</div>
	</div>
</body>
<script type="text/javascript" src="static/denglu/js/jquery.min.js"></script>
<script type="text/javascript" src="static/denglu/js/jquery-ui.min.js"></script>
<script type="text/javascript"
	src='static/denglu/js/stopExecutionOnTimeout.js?t=1'></script>
<script type="text/javascript" src="static/denglu/layui/layui.js"></script>
<script type="text/javascript" src="static/denglu/js/Particleground.js"></script>
<script type="text/javascript" src="static/denglu/js/Treatment.js"></script>
<script type="text/javascript" src="static/denglu/js/jquery.mockjax.js"></script>
<script type="text/javascript">
//验证账号密码是否正确


var canGetCookie = 0;//是否支持存储Cookie 0 不支持 1 支持
var ajaxmockjax = 1;//是否启用虚拟Ajax的请求响 0 不启用  1 启用
//默认账号密码

var CodeVal = 0;

$(document).keypress(function(e) {
	// 回车键事件  
	if (e.which == 13) {
		$('input[type="button"]').click();
	}
});
//粒子背景特效
$('body').particleground({
	dotColor : '#E8DFE8',
	lineColor : '#133b88'
});
$('input[name="pwd"]').focus(function() {
	$(this).attr('type', 'password');
});
$('input[type="text"]').focus(function() {
	$(this).prev().animate({
		'opacity' : '1'
	}, 200);
});
$('input[type="text"],input[type="password"]').blur(function() {
	$(this).prev().animate({
		'opacity' : '.5'
	}, 200);
});
$('input[name="login"],input[name="pwd"]').keyup(function() {
	var Len = $(this).val().length;
	if (!$(this).val() == '' && Len >= 4) {
		$(this).next().animate({
			'opacity' : '1',
			'right' : '30'
		}, 200);
	} else {
		$(this).next().animate({
			'opacity' : '0',
			'right' : '20'
		}, 200);
	}
});
var open = 0;
layui.use('layer', function() {

	//非空验证
	$('input[type="button"]').click(function() {
		var login = $('input[name="login"]').val();
		var pwd = $('input[name="pwd"]').val();
		var code = $('input[name="code"]').val();

		if (login == '') {
			ErroAlert('请输入您的账号');
		} else if (pwd == '') {
			ErroAlert('请输入密码');
		}  else {
			checkLogin();
		}
	})
})

function checkLogin(){
	
	$.ajax({
		url:"check/checkLogin",
		data:$("#loginForm").serialize(),
		type:"post",
		dataType:"json",
		success:function(dt){
			
			console.log(dt);
			if(dt.status==500){
				ErroAlert(dt.msg);
			}
			if(dt.status==200){
				window.location.href="page/homepage";
			}
		},
		error:function(dt){
			
		}
			
	})
	
}


</script>
	

</html>